Detonate Ivan Bombs placed by the attacker using custom warhead. - #2365
Detonate Ivan Bombs placed by the attacker using custom warhead.#2365dh381-1 wants to merge 16 commits into
Conversation
|
To Chinese users:
|
|
To Chinese users:
|
|
|
||
| DEFINE_HOOK(0x702D19, TechnoClass_ReceiveDamage_IvanBombDetonate, 0x6) | ||
| { | ||
| GET(ObjectClass*, pThis, ESI); |
There was a problem hiding this comment.
pThis should be TechnoClass*. Besides, register esi has been popped here, I think you should not use it.
pThis 应该是 TechnoClass*。另外,ESI寄存器在此处已被弹出,我认为你不该用它。
There was a problem hiding this comment.
After changing the hook location,register esi can be used
换了一个hook位置,ESI寄存器现在就可以用了
|
Nightly build for this pull request:
This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build. |
| In `rulesmd.ini`: | ||
| ```ini | ||
| [SOMEWEAPON] ; WeaponType | ||
| IvanBomb.Detonate=true ; Enable bomb detonation (true/false), default: false. |
There was a problem hiding this comment.
| IvanBomb.Detonate=true ; Enable bomb detonation (true/false), default: false. | |
| IvanBomb.Detonate=false ; boolean |
If there is a fixed default value, it should be placed as the value on the right side of the equals sign; only the value type should be written after the semicolon.
| bool SkipWeaponPicking; | ||
|
|
||
| Nullable<bool> CylinderRangefinding; | ||
|
|
|
Other codes looking good |
Coronia
left a comment
There was a problem hiding this comment.
I think this doesn't have to be restricted to the owner's bomb. It would also be useful if another unit could detonate it. Something like this:
IvanBomb.Detonate.InvokerOnly -> whether it can only affect your own bomb or not
IvanBomb.Detonate.AffectsType -> TechnoTypes in this list can have their ivan bomb detonated by this warhead. Use empty list for all types
|
|
||
| if(auto pBomb = pThis->AttachedBomb) | ||
| { | ||
| if(auto pSourceExt = TechnoExt::Fetch(pSource)) |
There was a problem hiding this comment.
this sanity check is not nesseary
| if(!pWHExt->IvanBomb_Detonate) | ||
| return 0; | ||
|
|
||
| bool CanAffects = pWHExt->IvanBomb_Detonate_AffectsType.Contains(pThis->GetTechnoType()) |
There was a problem hiding this comment.
I think it will be better to check empty first
| [SOMEWARHEAD] ; WarheadType | ||
| IvanBomb.Detonate=true ; boolean | ||
| IvanBomb.Detonate.InvokerOnly=false ; boolean | ||
| IvanBomb.Detonate.AffectsType=HTNK,E1 ; List of Registration Name, use empty list for all types |
There was a problem hiding this comment.
It is unreasonable to reinvent a filter here.
| return ContinueCheck; | ||
| } | ||
|
|
||
| DEFINE_HOOK(0x701DFF, TechnoClass_ReceiveDamage_IvanBombDetonate, 0x7) |
There was a problem hiding this comment.
This hook is redundant.
You should process this in WarheadTypeExt::DetonateOnOneUnit.
| if(pWHExt->IvanBomb_Detonate_InvokerOnly) | ||
| { | ||
| if(pBomb->Owner == pSource && CanAffects) | ||
| pBomb->Detonate(); |
There was a problem hiding this comment.
Invoking a damage in another damage process is dangerous.
IMO resetting the timer would be better.
What kind of change is this?
Skip Changelog).Skip Changelog,Skip Docs).Skip Docs).Skip Changelog,Skip Docs,Skip Credits).Description
IvanBomb.Detonate.InvokerOnlyto configure whether the warhead can detonate Ivan bombs from other sources.IvanBomb.Detonate.AffectsTypeto configure which targets' Ivan bombs can be detonated by warhead, use empty for all types.In
rulesmd.ini: